/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import { ClassTypeConst } from '../../../common/options/class-type-const.js';
import { Module, Project } from '../../../external/core/hvigor-core-node.js';

import { DefaultNodeImpl } from './default-node-impl.js';

/**
 * hvigor工程的基础module
 *
 * @since 2021/12/27
 */
export class ModuleImpl extends DefaultNodeImpl implements Module {
  classKind = ClassTypeConst.HVIGOR_MODULE;
  private readonly _project: Project;

  constructor(project: Project, moduleName: string, moduleDir: string) {
    super(moduleName, moduleDir);
    this._project = project;
  }

  findModuleByName(moduleName: string): Module | undefined {
    return this._project.getSubModules().get(moduleName);
  }

  getProject(): Project {
    return this._project;
  }
}
